package org.yibinxueyuan.drawcard.mapper.mapperImpl;

import org.springframework.context.support.ApplicationObjectSupport;
import org.springframework.stereotype.Repository;
import org.yibinxueyuan.drawcard.mapper.CommonToolsDao;

import java.util.List;
@Repository(value = "commonToolsDaoImpl")
public class CommonToolsDaoImpl extends ApplicationObjectSupport implements CommonToolsDao {

    @Override
    public List<Integer> getRandomNumbers(Integer n) {
        List<Integer> listNumber = (List<Integer>) this.getApplicationContext().getBean("ArrayListBean");
        listNumber.clear();
        /**
         * 获取n次随机数
         */
        for(int i = 0; i < n; i++){
            //获取0-999之间的随机数
            int number = (int)(Math.random()*1000);
            //将随机数保存
            listNumber.add(number);
        }
        return listNumber;
    }
}
